<?php 
		$path=$pagepath;
		session_start(); 
?>			<!-- COLONNA SINISTRA (se abilitata) -->
			<div id="sidebar-left">
<?php
		include './includes/connect.php';
		include './includes/profile.php';
?>
<?php
		include './includes/modules.php';
?>
							
			</div>
			<!-- COLONNA DESTRA (se abilitata) -->
			<div id="sidebar">
<?php
		include './includes/connect.php';
		include './includes/profile.php';
?>
				<div id="aside">
					<div id="nav">
						<dl>
							<dt>Ultimi articoli</dt>
<?php
		$articoli_fetchati = 0;
		$sql = "SELECT titolo,data,id FROM articoli ORDER BY id DESC LIMIT 0,3"; 
		$query = @mysql_query($sql) or die (mysql_error());
	    if(mysql_num_rows($query) > 0){
    		$assoc = mysql_fetch_array($query) or die (mysql_error());
    		$articolo = stripslashes($assoc['titolo']);
    		$data = $assoc['data'];
            $result = mysql_query($sql) or die ("Errore: ".mysql_error());
            while($assoc = mysql_fetch_assoc($result)){
            	$articoli_fetchati++;
?>
								<dd><?=$assoc['data'];?> - <a href="articolo.php?post=<?=$assoc['titolo'];?>&amp;id=<?=$assoc['id'];?>"><?=$assoc['titolo'];?></a></dd>
<?php
			}
			if ($articoli_fetchati==0){
?>
								<dd>Non sono presenti articoli postati recentemente.</dd>
<?php
			}
		}
?>
						</dl>
					</div>
					<div id="nav">
						<dl>
							<dt>Utility</dt>
<?php    	
		$sql = "SELECT * FROM utility ORDER BY utility_id ASC"; 
		$query = @mysql_query($sql) or die (mysql_error());
	    if(mysql_num_rows($query) > 0){
    		$assoc = mysql_fetch_array($query) or die (mysql_error());
    		$nome_link = stripslashes($assoc['utility_nome']);
    		$url_link = $assoc['utility_url'];
            $result = mysql_query($sql) or die ("Errore: ".mysql_error());
            while($assoc = mysql_fetch_assoc($result)){
?>
								<dd><a href="<?=$assoc['utility_url'];?>"><?=$assoc['utility_nome'];?></a></dd>
<?php		          
			}
		}
?>
						</dl>
					</div>
					<div id="nav">
						<dl>
							<dt>Suggested</dt>
<?php    	
		$sql = "SELECT * FROM suggested ORDER BY sug_id ASC"; 
		$query = @mysql_query($sql) or die (mysql_error());
	    if(mysql_num_rows($query) > 0){
    		$assoc = mysql_fetch_array($query) or die (mysql_error());
    		$nome_link = stripslashes($assoc['sug_nome']);
    		$url_link = $assoc['sug_url'];
            $result = mysql_query($sql) or die ("Errore: ".mysql_error());
            while($assoc = mysql_fetch_assoc($result)){
?>
								<dd><a href="<?=$assoc['sug_url'];?>"><?=$assoc['sug_nome'];?></a></dd>
<?php		          
			}
		}
?>
						</dl>
					</div>
				</div>
				<div id="aside-admin-area">
					<div id="admin-area">
						<dl>
							<dt>Admin area</dt>
<?php
	if(isset($_SESSION['utente'])){
?>
								<dd><a href="new_post.php">Nuovo articolo</a></dd>
								<dd><a href="post.php">Gestione articoli</a></dd><br />
								<dd><a href="utility.php">Gestione modulo utility</a></dd>
								<dd><a href="suggested.php">Gestione modulo suggested</a></dd>
								<dd><a href="navbar.php">Gestione barra superiore</a></dd><br />
								<dd><a href="profile.php?id=1">Modifica informazioni personali</a></dd>
								<dd><a href="avatar.php">Modifica avatar</a></dd><br />
								<dd><a href="temi.php">Cambia tema</a></dd>
								<dd><a href="info.php?id=1">Modifica informazioni blog</a></dd>
								<dd><a href="change_password.php">Modifica password</a></dd>
								<dd><a href="<?php echo $path . INCLUDES_PATH . "logout.php" ?>">Logout</a></dd>
<?php
	}
	else {
?>
								<dd><a href="login.php">Login</a></dd>
<?php
	}
?>
						</dl>
					</div>
				</div>
				<div id="ghost"></div>
			</div>
